package com.jinlia.show.modules.system.controller;

import com.jinlia.show.modules.base.system.entity.MemberCardBalanceChange;
import com.jinlia.show.modules.base.system.service.MemberCardBalanceChangeMapperService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequiredArgsConstructor
@RequestMapping("/member/balance")
public class MemberCardBalanceChangeController {

    @Autowired
    MemberCardBalanceChangeMapperService memberCardBalanceChangeMapperService;

    @PostMapping("/card/{id}")
    public List<MemberCardBalanceChange> get(@PathVariable(value = "id") Long id) {
        List<MemberCardBalanceChange> list = memberCardBalanceChangeMapperService.lambdaQuery()
                .eq(MemberCardBalanceChange::getMemberCardId, id)
                .orderByDesc(MemberCardBalanceChange::getId)
                .list();
        return list;
    }
}
